/*
 *  Project     : QKeyboardStatistic
 *  Author      : Durachenko Aleksey V. <durachenko.aleksey@gmail.com>, 2011
 *  Licence     : GNU GENERAL PUBLIC LICENSE Version 2
 */
#ifndef CMAINWINDOW_H
#define CMAINWINDOW_H

#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QCloseEvent>
#include "cstatistic.h"
#include "chookthread.h"
#include "ui_mainwindow.h"

class CMainWindow : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
    CMainWindow(QWidget* parent = 0, Qt::WFlags f = 0);
    ~CMainWindow();

protected:
    void closeEvent(QCloseEvent* event);
    void customEvent(QEvent* event);

private slots:
    void on_action_ShowHide_triggered();
    void on_action_Quit_triggered();
    void on_action_Settings_triggered();
    void on_action_About_triggered();
    void slot_mSystemTrayIcon_activated(QSystemTrayIcon::ActivationReason reason);
    void slot_updateKeyCounter();
    void slot_updateMousePressCounter();
    void slot_updateMileage();

private:
    void writeSettings();
    void readSettings();
    QString createMileage(qint64 mileage);
    QString createReadable(qint64 value);

private:
    CHookThread* mHookThread;
    QSystemTrayIcon* mSystemTrayIcon;
    CStatistic* mStatistic;
    double mPixelResulution;

};

#endif
